package com.dorm.common.utils;

import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;

public class DateUtils {
    private static final DateTimeFormatter DEFAULT_FORMATTER = 
        DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");

    public static String format(LocalDateTime dateTime) {
        return dateTime != null ? dateTime.format(DEFAULT_FORMATTER) : "";
    }

    public static LocalDateTime parse(String dateTimeStr) {
        return dateTimeStr != null && !dateTimeStr.isEmpty() ? 
            LocalDateTime.parse(dateTimeStr, DEFAULT_FORMATTER) : null;
    }
} 